/**
 *  Copyright (c) 2017-2022 Rushang Co.Ltd All Rights Reserved.
 */
package com.rshang.rsdp.util.i18n;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;

/**
 * 功能简介：国际化语言工具类<br/>
 * @author zhangjun
 * @create 2017年7月31日下午2:33:09
 * 
 */
@Component
public class I18nMessage {

	@Autowired 
	MessageSource message;
	
	/**
	 * 获取默认国际化语言信息
	 * @param key	key值
	 * @return
	 * 		String
	 */
	public String getMessage(String key) {
		return message.getMessage(key, null, LocaleContextHolder.getLocale());
	}

	/**
	 * 获取默认国际化语言信息
	 * @param key					key值
	 * @param paramArrayOfObject	参数数组
	 * @return
	 * 		String
	 */
	public String getMessage(String key, Object[] paramArrayOfObject) {
		return message.getMessage(key, paramArrayOfObject, LocaleContextHolder.getLocale());
	}

	/**
	 * 获取默认国际化语言信息
	 * @param key					key值
	 * @param paramArrayOfObject	参数数组
	 * @param paramString2			拼接字符串
	 * @return
	 * 		String
	 */
	public String getMessage(String key, Object[] paramArrayOfObject, String paramString2) {
		return message.getMessage(key, paramArrayOfObject, paramString2, LocaleContextHolder.getLocale());
	}
}
